//
//  LGTTaskVC.swift
//  KJLGT
//
//  Created by jenkin on 2019/8/7.
//  Copyright © 2019年 jenkin. All rights reserved.
//

import UIKit

class LGTTaskVC: LGTBaseVC {

    override func viewDidLoad() {
        super.viewDidLoad()
    }
    
    override func setUI() {
        super.setUI()
        self.setBavBarStyle(navBarHiden: false, title: "", back: false)
        self.view.backgroundColor = ViewBackColor
        
        let selectView1 = self.getTypeSelectView(title: "智能排序", tag: 0)
        self.navBar.addSubview(selectView1)
        selectView1.snp.makeConstraints { (make) in
            make.left.equalTo(SizeFitFloat(10))
            make.height.equalTo(SizeFitFloat(16))
            make.width.equalTo(SizeFitFloat(100))
            make.bottom.equalTo(-15)
        }
        
        let selectView2 = self.getTypeSelectView(title: "任务分类", tag: 0)
        self.navBar.addSubview(selectView2)
        selectView2.snp.makeConstraints { (make) in
            //make.left.equalTo(SizeFitFloat(10))
            make.centerX.equalToSuperview()
            make.height.equalTo(SizeFitFloat(16))
            make.width.equalTo(SizeFitFloat(100))
            make.bottom.equalTo(-15)
        }
        
        let selectView3 = self.getTypeSelectView(title: "筛选", tag: 0)
        self.navBar.addSubview(selectView3)
        selectView3.snp.makeConstraints { (make) in
            make.right.equalTo(-SizeFitFloat(10))
            make.height.equalTo(SizeFitFloat(16))
            make.width.equalTo(SizeFitFloat(60))
            make.bottom.equalTo(-15)
        }
    }
    
    func getTypeSelectView(title:String, tag:Int) -> LGTTaskTypeSelectView{
        let selectView:LGTTaskTypeSelectView = LGTViewCreateUtil.share.createTaskTypeSelectView(position: LGTTaskTypeSelectView.Position.right, spaceX:SizeFitFloat(5), title: title, image:"drop_down", selectImage:"retract", font: Font_Normal_15, color: TextColor, selectedColor: TextColor, dH:5)
        selectView.tag = tag
        selectView.addTarget(self, action: #selector(selectAction), for: UIControl.Event.touchUpInside)
        return selectView
    }
    
    @objc func selectAction(sender:LGTTaskTypeSelectView){
        
        sender.isSelected = !sender.isSelected
        
    }
}
